<?php

// +----------------------------------------------------------------------
// | TAODUDU.COM  [ Simple Efficient Excellent ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016 http://www.taodudu.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: ubten <462193409@qq.com> http://www.ubten.com/
// +----------------------------------------------------------------------

namespace Admin\Controller;
use Admin\Controller\AdminController;
class LogsController extends AdminController {
    
    function _initialize() {
        parent::_initialize();
        $this->assign('sys', 'setting'); // 数据集
    }
    
    public function index(){
        $users = M('member_logs');
        $count = $users->where($datas)->count();// 查询满足要求的总记录数
        $Page = new \Think\Page($count,15);// 实例化分页类 传入总记录数和每页显示的记录数(25)
        $show = $Page->show();// 分页显示输出
        $list = $users->where($datas)->order('id desc')->limit($Page->firstRow.','.$Page->listRows)->select();
        $this->assign('list',$list);// 赋值数据集
        $this->assign('pages',$show);// 赋值分页输出
        $this->assign('action', 'logs');
        $this->display();
    }
    //put your code here
    
   /**
     * 删除
     */
    public function delLog() {
        $Id = I('post.data', 0, 'intval');
        if (empty($Id)) {
            $this->error('参数不能为空！');
        }
        if ($this->model->where('uid=' . $Id)->delete()) {
            $this->success('删除成功！', U('my'));
        } else {
            $this->error('删除失败！');
        }
    }
    
    
}
